package com.wcar.product.controller;

import com.wcar.common.entity.*;
import com.wcar.common.vo.Result;
import com.wcar.product.service.impl.ProductServiceImpl;
import com.wcar.product.vo.ReviewCountVo;
import com.wcar.product.vo.SelectPeopleAndRatingVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/product/mobile/store/api")
public class ProductMobile {
    @Autowired
    private ProductServiceImpl productService;
    @PostMapping("/select")
    public Result<List<Product>> GetProductByTypeId(@RequestParam String proTypeId, @RequestParam String productName){
        return productService.GetProductByTypeId(proTypeId,productName);
    }
    @PostMapping("/selectProductAndStoreNameByStoreId")
    public Result<List<Product>> selectProductAndStoreNameByStoreId(@RequestParam String productName,@RequestParam Integer storeId){
        return productService.selectProductAndStoreNameByStoreId(productName,storeId);
    }
    @PostMapping("/selectProductAndStoreNameByProductName")
    public Result<List<Product>> selectProductAndStoreNameByStoreId(@RequestParam String productName){
        return productService.selectProductAndStoreNameByProductName(productName);
    }
    @PostMapping("/selectStoreNameAndRatingByStoreName")
    public Result<SelectPeopleAndRatingVo> selectStoreNameAndRatingByStoreName(@RequestParam String storeName){
        return productService.selectStoreNameAndRatingByStoreName(storeName);
    }
    @PostMapping("/selectProductImagesByProductId")
    public Result<List<ProductReviewImage>> selectProductImagesByProductId(@RequestParam Integer productId){
        return productService.selectProductImagesByProductId(productId);
    }
    @PostMapping("/selectContentByProductId")
    public Result<ReviewCountVo> selectContentByProductId(@RequestParam Integer productId){
        return productService.selectContentByProductId(productId);
    }
    @PostMapping("/selectCommentsVoByProductId")
    public Result<List<ProductReview>> selectCommentsVoByProductId(@RequestParam Integer productId){
        return productService.selectContentsByProductId(productId);
    }
    @PostMapping("/insertProductOrder")
    public Result<ProductReview> insertProductOrder(@RequestBody ProductOrder productOrder){
        return productService.insertProductOrder(productOrder);
    }
}
